#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int arr[100] = { 0 };
	int n = 0;
	int i = 0;
	int j = 0;
	int mid = 0;
	int m = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &arr[i]);
	}
	while (arr[j])
	{
		mid++;
		j += 2;
	}
	printf("%d\n", mid);
	return 0;
}